import Home from '@/views/home'
import Category from '@/views/category'
import Find from '@/views/find'
import Reservation from '@/views/reservation'
import List from '@/views/list'
import Cart from '@/views/cart'
import Mine from '@/views/mine'
import Detail from '@/views/detail'
import Login from '@/views/login'
import Register from '@/views/register'
import TabBar from '@/components/tab-bar'
import TitleBar from '@/components/title-bar'

const routes = [
  { // 重定向，默认进入home
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home', // 路由路径
    // component: Home, // 路由组件
    components: {
      header: TitleBar,
      default: Home,
      footer: TabBar
    },
    meta: {
      // 路由元信息
      isTabBar: true,
      title: '首页',
      icon: '&#xe66e;'
    }
  },
  {
    path: '/find',
    // component: Find,
    components: {
      header: TitleBar,
      default: Find,
      footer: TabBar
    },
    meta: {
      isTabBar: true,
      title: '发现',
      icon: '&#xe667;'
    }
  },
  {
    path: '/category',
    // component: Category,
    components: {
      header: TitleBar,
      default: Category,
      footer: TabBar
    },
    meta: {
      isTabBar: true,
      title: '菜单',
      icon: '&#xe660;'
    }
  },
  {
    path: '/reservation',
    // component: Reservation,
    components: {
      header: TitleBar,
      default: Reservation,
      footer: TabBar
    },
    meta: {
      isTabBar: true,
      title: '预约',
      icon: '&#xe663;'
    }
  },
  {
    path: '/list', //
    component: List
  },
  {
    path: '/detail', //
    component: Detail,
    meta: {
      title: '详情'
    }
  },
  {
    path: '/cart', //
    component: Cart,
    meta: {
      title: '购物车'
    }
  },
  {
    path: '/mine', //
    // component: Mine,
    components: {
      header: TitleBar,
      default: Mine,
      footer: TabBar
    },
    meta: {
      isTabBar: true,
      title: '我的',
      icon: '&#xe66c;'
    }
  },
  {
    path: '/register', //
    component: Register,
    meta: {
      title: '注册'
    }
  },
  {
    path: '/login', //
    component: Login,
    meta: {
      title: '登录'
    }
  }
]

export default routes
